package com.example.day09_7_9_1;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;

import com.example.day09_7_9_1.databinding.ActivityMainBinding;
import com.google.android.material.navigation.NavigationView;

import java.net.URL;

public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
    private ActivityMainBinding root;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        root = ActivityMainBinding.inflate(LayoutInflater.from(this));
        setContentView(root.getRoot());
        initView();

    }

    private void initView() {
        root.toolbar.setTitle("首页");
        setSupportActionBar(root.toolbar);
        root.nav.setItemIconTintList(null);
        root.nav.setNavigationItemSelectedListener(this);
        ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, root.drl, root.toolbar, R.string.app_name, R.string.app_name);
        root.drl.addDrawerListener(actionBarDrawerToggle);
        actionBarDrawerToggle.syncState();
    }

    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
        return false;
    }
}
